package com.globalwave.common.web;

import com.globalwave.base.BaseAction;
import com.globalwave.common.ArrayPageList;
import com.globalwave.common.entity.SyncConfig;
import com.globalwave.common.entity.SyncConfigCriterion;
import com.globalwave.common.service.SyncConfigService;
import com.opensymphony.xwork2.Preparable;

public class SyncConfigAction extends BaseAction implements Preparable {

    private static final long serialVersionUID = 8582051849254108462L;
    
    private SyncConfigService syncConfigService ;
    private SyncConfig syncConfig ;
    private SyncConfigCriterion criterion ; 

    
    public String execute() throws Exception {    
        return this.list();    
    }
    
    public String list() throws Exception {      
        
        ArrayPageList<SyncConfig> pageList = 
            syncConfigService.query(criterion,pageIndex,pageSize,null) ;

        renderXML(pageList.asXML()) ;
        
        return null ;    
        
    }
    
    public String create()  throws Exception {              
        
        Object newSyncConfig = syncConfigService.create(syncConfig) ;

        renderXML(this.getSuccessCreateMessage(newSyncConfig).asXML()) ;
        
        return null;    
        
    }
    
    public String update()  throws Exception {     
        
        syncConfigService.update(syncConfig) ;

        renderXML(this.getSuccessUpdateMessage(syncConfig).asXML()) ;
        
        return null;    
        
    }
    
    public String delete()  throws Exception {
        if (ids == null) { 
            syncConfigService.delete(syncConfig) ;
        } else {
            syncConfigService.deleteAll(ids) ;
        }

        renderXML(this.getSuccessDeleteMessage().asXML()) ;
        
        return null;    
        
    }
    
    public void prepare() throws Exception {
        // Auto-generated method stub , donothing
        
    }
    
    public void setSyncConfigService(SyncConfigService syncConfigService) {
        this.syncConfigService = syncConfigService;
    }

    public SyncConfig getSyncConfig() {
        return syncConfig;
    }

    public void setSyncConfig(SyncConfig syncConfig) {
        this.syncConfig = syncConfig;
    }

    public SyncConfigCriterion getCriterion() {
        return criterion;
    }

    public void setCriterion(SyncConfigCriterion criterion) {
        this.criterion = criterion;
    }

}
